package user;

import Dao.communityDao;
import Dao.communityDaoImpl;
import been.Health;
import jakarta.servlet.ServletException;
import jakarta.servlet.annotation.WebServlet;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import lombok.Data;

import java.io.IOException;
import java.util.Date;

@WebServlet(name = "userServlet",value = "/user-community")
public class userServlet extends HttpServlet {
    public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        String action = request.getParameter("action");
        switch (action){
            case "healthInformation":
                request.getRequestDispatcher("/WEB-INF/user/healthInformation.jsp").forward(request,response);
                break;
            case "Message":
                request.getRequestDispatcher("/WEB-INF/user/message.jsp").forward(request,response);
                break;
            case "userManagement":
                request.getRequestDispatcher("/WEB-INF/user/userManagement.jsp").forward(request,response);
                break;
            case "Logout":
                request.getRequestDispatcher("/WEB-INF/Login/Login.jsp").forward(request,response);
                break;
            case "return":
                request.getRequestDispatcher("/WEB-INF/user/healthInformation.jsp").forward(request,response);
                break;
            case "returnUser":
                request.getRequestDispatcher("/WEB-INF/Login/user.jsp").forward(request,response);
                break;
            case "returnManagement":
                request.getRequestDispatcher("/WEB-INF/user/userManagement.jsp").forward(request,response);
                break;
            case "returnMessage":
                request.getRequestDispatcher("/WEB-INF/user/message.jsp").forward(request,response);
                break;
            case "returnAdmin":
                request.getRequestDispatcher("/WEB-INF/Login/admin.jsp").forward(request,response);
        }
    }
}
